var express = require("express");
var router = express.Router();
//引入第二层的方法
let {
	getClasses,
	addClasses,
	deleteClasses,
	updateClasses,
	// searchClasses,
} = require("../service/classesService");

//获取分类数据
router.get("/getClasses", async function (req, res, next) {
	//调用第二层的函数,传值
	let data = await getClasses(req.query);
	res.send(data);
});
//增加分类
router.post("/addClasses", async function (req, res, next) {
	let data = await addClasses(req.body);
	// console.log(11111, data);
	res.send(data);
});
//删除分类
router.post("/deleteClasses", async function (req, res, next) {
	let data = await deleteClasses(req.body);
	// console.log(11111, data);
	res.send(data);
});

//修改分类

router.post("/updateClasses", async function (req, res, next) {
	let data = await updateClasses(req.body);
	console.log(111116666, data);
	res.send(data);
});

//获取指定分类数据

module.exports = router;
